#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:p="http://primefaces.org/ui"
                 xmlns:x="http://xpert.com/faces"
                 xmlns:custom="http://java.sun.com/jsf/composite/components"
                 >
    <h:form>
        <x:modalMessages/>
        <p:tabView>
            <p:tab title="${symbol_pound}{msg['dadosGerais']}">
                <div class="container-fluid">
                    <div class="row">
                        <div class="form-group col-lg-6 col-md-12 col-sm-12 col-xs-12">
                            <h:outputLabel value="* ${symbol_pound}{msg['perfil.descricao']}:" />
                            <p:inputText value="${symbol_pound}{perfilMB.entity.descricao}" maxlength="255"  styleClass="form-control"   />
                        </div>

                        <div class="form-group col-lg-12 col-md-12 col-sm-6 col-xs-12">
                            <div class="checkbox">
                                <label>
                                    <h:selectBooleanCheckbox value="${symbol_pound}{perfilMB.entity.ativo}" />
                                    ${symbol_pound}{msg['perfil.ativo']}
                                </label>
                            </div>
                        </div>
                    </div>
                </div>

            </p:tab>
            <p:tab title="${symbol_pound}{msg['acessosDoPerfil']}">
                <p:tree value="${symbol_pound}{perfilMB.permissoes}" var="permissao"
                        selectionMode="checkbox" style="max-height: 500px; overflow-y: scroll;"
                        selection="${symbol_pound}{perfilMB.permissoesSelecionadas}">  
                    <p:treeNode styleClass="class-check-${symbol_pound}{permissao.id}">  
                        <h:outputText value="${symbol_pound}{permissao.descricao}" />  
                        <h:panelGroup rendered="${symbol_pound}{not sessaoUsuarioMB.hasRole(permissao.key)}">
                            <script>
                                Xpert.disableTreeNode(".class-check-${symbol_pound}{permissao.id}");
                            </script>
                        </h:panelGroup>
                    </p:treeNode>  
                </p:tree>  
            </p:tab>
            <p:tab title="${symbol_pound}{msg['perfil.permissoesMenu']}" rendered="${symbol_pound}{not empty perfilMB.entity.id}">
                <div style="max-height: 500px; overflow-y: scroll;">
                    <p:tree value="${symbol_pound}{perfilMB.permissoesMenu}" var="permissao"
                            selectionMode="checkbox"  
                            selection="${symbol_pound}{perfilMB.permissoesSelecionadasMenu}">  
                        <p:treeNode>  
                            <h:outputText value="${symbol_pound}{permissao.descricao}" />  
                        </p:treeNode>  
                    </p:tree>  
                </div>
            </p:tab>

        </p:tabView>
        <h:outputText value="${symbol_pound}{xmsg['requiredFieldsForm']}"/>
        <div style="text-align: center;">
            <x:securityArea rolesAllowed="perfil.create">
                <p:commandButton process="@form" update="@form" action="${symbol_pound}{perfilMB.save}" value="${symbol_pound}{xmsg['save']}" />
            </x:securityArea>
            <x:securityArea rolesAllowed="perfil.audit">
                <x:audit for="${symbol_pound}{perfilMB.entity}"/>
            </x:securityArea>
        </div>
    </h:form>
</ui:composition>